package testLayer;

import static org.junit.Assert.*;
import modelLayer.OrderLine;
import modelLayer.Product;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class OrderLineTest {
	
	private OrderLine orderLine;
	private Product product = new Product(1, 2, 123, 132, 231, 213, "Cowboy_Hat", "danmark", "Clothing", "This_is_indeed_a_hat", "Medium", "Brown", "Leather", null);
	private Product productTwo = new Product(1, 2, 123, 132, 231, 213, "Cowboy_Boots", "Denmark", "Clothing", "This_is_indeed_a_hat", "Medium", "Brown", "Leather", null);

	
	@Before
	public void setUp() throws Exception {
		
		this.orderLine = new OrderLine(1234, this.product);
		
	}

	@After
	public void tearDown() throws Exception {
		
		
		
	}

	@Test
	public void testOrderLineWithParametersSuccess() {
		
		this.orderLine = new OrderLine();
		assertTrue(this.orderLine != null);
		
	}
	
	@Test
	public void testOrderLineWithParametersFails() {
		
		this.orderLine = new OrderLine();
		assertFalse(this.orderLine == null);
		
	}
	
	@Test
	public void testGetAmountSuccess() {
		
		assertEquals(1234, this.orderLine.getAmount());
		
	}
	
	@Test
	public void testGetAmountFails() {
		
		assertNotSame(4321, this.orderLine.getAmount());
		
	}
	
	@Test
	public void testSetAmountSuccess() {
		
		this.orderLine.setAmount(4321);
		assertEquals(4321, this.orderLine.getAmount());
		
	}
	
	@Test
	public void testSetAmountFails() {
		
		this.orderLine.setAmount(4321);
		assertNotSame(4321, this.orderLine.getAmount());
		
	}
	
	@Test
	public void testGetProductSuccess() {
		
		assertEquals(this.product, this.orderLine.getProduct());
		
	}
	
	@Test
	public void testGetProductFails() {
		
		assertNotSame(this.productTwo, this.orderLine.getProduct());
		
	}
	
	@Test
	public void testSetProductSuccess() {
		
		this.orderLine.setProduct(this.productTwo);
		assertEquals(this.productTwo, this.orderLine.getProduct());
		
	}
	
	@Test
	public void testSetProductFails() {
		
		this.orderLine.setProduct(this.productTwo);
		assertNotSame(this.product, this.orderLine.getProduct());
		
	}
}
